<?php

/**
 * Created by PhpStorm.
 * User: zhangrongxiang
 * Date: 2017/5/22
 * Time: 上午9:16
 */
class Test
{
    static public function getNew()
    {
        return new static;
    }

    public function getNew2()
    {
        return new self();
    }
}

class Child extends Test
{
}

$obj1 = new Test();
$obj2 = new $obj1;
var_dump($obj1 !== $obj2);

$obj3 = Test::getNew();
var_dump($obj3 instanceof Test);

$obj3 = $obj1->getNew2();
var_dump($obj3 instanceof Test);

$obj4 = Child::getNew();
var_dump($obj4 instanceof Child);